
{include file="layout/css"}
{include file="layout/header"}
<div class="layui-container fly-marginTop">
    <div class="fly-panel fly-panel-user" pad20>
        <div class="layui-tab layui-tab-brief" lay-filter="user">
            <ul class="layui-tab-title">
                <li><a href="login.html">登入</a></li>
                <li class="layui-this">注册</li>
            </ul>
            <div class="layui-form layui-tab-content" id="LAY_ucm" style="padding: 20px 0;">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form layui-form-pane">
                        <form method="post">
                            <div class="layui-form-item">
                                <label for="L_username" class="layui-form-label">用户名</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_username" name="username" required="" lay-verify="username"
                                           autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    用于登入
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_pass" class="layui-form-label">密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_pass" name="pass" required="" lay-verify="required"
                                           autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    6到30个字符
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_repass" class="layui-form-label">重复密码</label>
                                <div class="layui-input-inline">
                                    <input type="password" id="L_repass" name="repass" required="" lay-verify="required"
                                           autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    6到30个字符
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_nickname" class="layui-form-label">昵称</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_nickname" name="nickname" required="" lay-verify="required"
                                           autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    你在社区的名字，仅允许小写字母和数字，大写字母会自动转换成小写字母
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_nickname" class="layui-form-label">邮箱</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="email" name="email" required="" lay-verify="required"
                                           autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid layui-word-aux">
                                    用于忘记密码的情况下，重置密码
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <label for="L_imagecode" class="layui-form-label">图形码</label>
                                <div class="layui-input-inline">
                                    <input type="text" id="L_imagecode" name="verify_code" required=""
                                           lay-verify="required" autocomplete="off" class="layui-input"/>
                                </div>
                                <div class="layui-form-mid" style="padding: 0!important;">
                                    <span style="color: #c00;"><img class="codeImage"
                                                                    src="https://api.laytp.com/captcha/register" width="100"
                                                                    height="38"/></span>
                                </div>
                            </div>
                            <div class="layui-form-item">
                                <button class="layui-btn register"
                                        style="border-radius: 4px;background-color: #5FB878!important;height: 36px;line-height: 36px;box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);"
                                        alert="1" lay-filter="register" lay-submit="">立即注册
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    layui.use(['facade', 'button'], function () {
        //点击验证码图片，获取新的验证码图片地址
        layui.$(document).off("click", ".codeImage").on("click", ".codeImage", function () {
            this.src = localStorage.getItem("apiDomain") + "/captcha/register?v=" + Math.random();
        });

        layui.form.on('submit(register)', function (data) {
            var buttonAnim = layui.button.load({elem: '.register'});
            data.field.session_id = facade.getCookie('PHPSESSID');
            facade.ajax({route: '/user/register', data: data.field}).done(function (res) {
                if (res['code'] === 0) {
                    window.location.href = localStorage.getItem("wwwDomain") + '/login.html';
                } else {
                    layui.$(".codeImage").click();
                    layui.$("#L_imagecode").val('');
                }
                buttonAnim.stop();
            }).fail(function () {
                buttonAnim.stop();
            });
            return false;
        });
    });
</script>
{include file="layout/footer"}
</body>

<!-- Mirrored from www.laytp.com/register.html by HTTrack Website Copier/3.x [XR&CO'2014], Sat, 08 Mar 2025 06:05:07 GMT -->
</html>